import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'
import { translate as $t } from "../i18n/index.js" 
/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  // {
  //   path: '/login',
  //   component: () => import('@/views/login/index'),
  //   hidden: true
  // },
  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },
  // {
  //   path: '/',
  //   component: Layout,
  //   redirect: '/dashboard',
  //   children: [{
  //     path: 'dashboard',
  //     name: 'Dashboard',
  //     component: () => import('@/views/dashboard/index'),
  //     meta: { title: '报告', icon: 'dashboard' }
  //   }]
  // },
  {
    path: '/',
    component: Layout,
    redirect: '/proofs',
    children: [{
      path: 'proofs',
      name: 'proofs',
      component: () => import('@/views/proofs/index'),
      meta: { title: $t("router.title"), icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/analyzeData',
    name: 'analyzeData',
    hidden: true,
    component: () => import('@/views/analyzeData/index.vue'), // 根据你的组件位置调整路径
    meta: { title: '全屏页面' } // 根据需要调整标题
  },
  {
    path: '/',
    component: Layout,
    redirect: '/proofs',
    hidden:true,
    children: [{
      path: 'proofBaseList',
      name: 'proofBaseList',
      component: () => import('@/views/basePhone/proofBaseList/index'),
      meta: { title: '蓝牙信息', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/table',
    component: Layout,
    redirect: '/table',
    hidden:true,
    children: [{
      path: 'table',
      name: 'table',
      component: () => import('@/views/basePhone/table/index'),
      meta: { title: '任务管理', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/wifiInfo',
    component: Layout,
    redirect: '/wifiInfo',
    hidden:true,
    children: [{
      path: 'wifiInfo',
      name: 'wifiInfo',
      component: () => import('@/views/basePhone/wifiInfo/index'),
      meta: { title: 'WIFI', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/gpsInfo',
    component: Layout,
    redirect: '/gpsInfo',
    hidden:true,
    children: [{
      path: 'gpsInfo',
      name: 'gpsInfo',
      component: () => import('@/views/basePhone/GPS/index'),
      meta: { title: 'GPS', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/Battery',
    component: Layout,
    redirect: '/Battery',
    hidden:true,
    children: [{
      path: 'Battery',
      name: 'Battery',
      component: () => import('@/views/basePhone/batteryInformation/index'),
      meta: { title: '电量信息', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/baseInfo',
    component: Layout,
    redirect: '/baseInfo',
    hidden:true,
    children: [{
      path: 'baseInfo',
      name: 'baseInfo',
      component: () => import('@/views/basePhone/baseInfo/index'),
      meta: { title: '基础信息', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/CPU',
    component: Layout,
    redirect: '/CPU',
    hidden:true,
    children: [{
      path: 'CPU',
      name: 'CPU',
      component: () => import('@/views/basePhone/CPU/index'),
      meta: { title: 'CPU', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/disStatus',
    component: Layout,
    redirect: '/disStatus',
    hidden:true,
    children: [{
      path: 'disStatus',
      name: 'disStatus',
      component: () => import('@/views/basePhone/diskStatus/index'),
      meta: { title: '磁盘状态', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/batteryStatus',
    component: Layout,
    redirect: '/batteryStatus',
    hidden:true,
    children: [{
      path: 'batteryStatus',
      name: 'batteryStatus',
      component: () => import('@/views/basePhone/batteryStatus/index'),
      meta: { title: '电池信息', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/inputtingMethod',
    component: Layout,
    redirect: '/inputtingMethod',
    hidden:true,
    children: [{
      path: 'inputtingMethod',
      name: 'inputtingMethod',
      component: () => import('@/views/basePhone/inputtingMethod/index'),
      meta: { title: '输入法', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/networkAddress',
    component: Layout,
    redirect: '/networkAddress',
    hidden:true,
    children: [{
      path: 'networkAddress',
      name: 'networkAddress',
      component: () => import('@/views/basePhone/networkAddress/index'),
      meta: { title: '网络地址', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/ApplicationInfo',
    component: Layout,
    redirect: '/ApplicationInfo',
    hidden:true,
    children: [{
      path: 'ApplicationInfo',
      name: 'ApplicationInfo',
      component: () => import('@/views/basePhone/ApplicationInfo/index'),
      meta: { title: '应用信息', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/content',
    component: Layout,
    redirect: '/content',
    hidden:true,
    children: [{
      path: 'content',
      name: 'content',
      component: () => import('@/views/basePhone/content/index'),
      meta: { title: 'CONTENT', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/saveInfo',
    component: Layout,
    redirect: '/saveInfo',
    hidden:true,
    children: [{
      path: 'saveInfo',
      name: 'saveInfo',
      component: () => import('@/views/basePhone/saveInfo/index'),
      meta: { title: '存储信息、挂载信息', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/Memory',
    component: Layout,
    redirect: '/Memory',
    hidden:true,
    children: [{
      path: 'Memory',
      name: 'Memory',
      component: () => import('@/views/basePhone/Memory/index'),
      meta: { title: '内存信息', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/Biofingerprint',
    component: Layout,
    redirect: '/Biofingerprint',
    hidden:true,
    children: [{
      path: 'Biofingerprint',
      name: 'Biofingerprint',
      component: () => import('@/views/basePhone/Biofingerprint/index'),
      meta: { title: '生物指纹个数', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/temperature',
    component: Layout,
    redirect: '/temperature',
    hidden:true,
    children: [{
      path: 'temperature',
      name: 'temperature',
      component: () => import('@/views/basePhone/temperature/index'),
      meta: { title: '温度属性', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/userPass',
    component: Layout,
    redirect: '/userPass',
    hidden:true,
    children: [{
      path: 'userPass',
      name: 'userPass',
      component: () => import('@/views/basePhone/userPass/index'),
      meta: { title: '用户密码相关', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/userAccount',
    component: Layout,
    redirect: '/userAccount',
    hidden:true,
    children: [{
      path: 'userAccount',
      name: 'userAccount',
      component: () => import('@/views/basePhone/userAccount/index'),
      meta: { title: '用户账号相关', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/autoPass',
    component: Layout,
    redirect: '/autoPass',
    hidden:true,
    children: [{
      path: 'autoPass',
      name: 'autoPass',
      component: () => import('@/views/basePhone/autoPass/index'),
      meta: { title: '自动申请密码', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/RSA',
    component: Layout,
    redirect: '/RSA',
    hidden:true,
    children: [{
      path: 'RSA',
      name: 'RSA',
      component: () => import('@/views/basePhone/RSA/index'),
      meta: { title: '连接过的电脑及RSA指纹', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/proofInfo',
    component: Layout,
    redirect: '/proofInfo',
    hidden:true,
    children: [{
      path: 'proofInfo',
      name: 'proofInfo',
      component: () => import('@/views/basePhone/proofInfo/index'),
      meta: { title: '手机设置相关', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/guazai',
    component: Layout,
    redirect: '/guazai',
    hidden:true,
    children: [{
      path: 'guazai',
      name: 'guazai',
      component: () => import('@/views/basePhone/guazai/index'),
      meta: { title: '挂载信息', icon: 'el-icon-tickets' }
    }]
  },
  {
    path: '/host',
    component: Layout,
    redirect: '/host',
    hidden:true,
    children: [{
      path: 'host',
      name: 'host',
      component: () => import('@/views/basePhone/host/index'),
      meta: { title: '主机隐藏空间', icon: 'el-icon-tickets' }
    }]
  },
  // {
  //   path: '/ApplicationBatteryInformation',
  //   component: Layout,
  //   redirect: '/ApplicationBatteryInformation',
  //   children: [{
  //     path: 'ApplicationBatteryInformation',
  //     name: 'appBatteryInfo',
  //     component: () => import('@/views/basePhone/ApplicationBatteryInformation/index'),
  //     meta: { title: '应用电量信息', icon: 'el-icon-tickets' }
  //   }]
  // },
  /* -------------------------------------分析------------------------------------- */
  {
    path: '/analyze',
    component: Layout,
    meta: {
      title: $t("router.analyze"),
      icon: 'el-icon-menu',
    },
    children: [
      {
          path: '/analyze/eventAnalysis',
          name: 'eventAnalysis',
          component: () => import('@/views/analyze/eventAnalysis/index'),
          meta: { title: $t("router.analyze"), icon: 'el-icon-s-marketing' },
      },
      {
          path: '/analyze/moneyAnalysis',
          name: 'moneyAnalysis',
          component: () => import('@/views/analyze/moneyAnalysis/index'),
          meta: { title: $t("router.eventAnalyze"), icon: 'el-icon-coin' },
      },
      {
          path: '/analyze/positionAnalysis',
          name: 'positionAnalysis',
          component: () => import('@/views/analyze/positionAnalysis/index'),
          meta: { title: $t("router.positionAnalyze"), icon: 'el-icon-location-information' },
      },
      {
          path: '/analyze/allSearch/index',
          name: 'allSearch',
          component: () => import('@/views/analyze/allSearch/index'),
          meta: { title: $t("router.allSearch"), icon: 'el-icon-search' },
      },
    //   {
    //     path: '/analyze/proof/index',
    //     name: 'proof',
    //     component: () => import('@/views/analyze/proof/index'),
    //     meta: { title: '单检材分析', icon: 'el-icon-pie-chart' },
    // },
      // {
      //   path: '/analyze/serverSearch/index',
      //   name: 'allselect',
      //   component: () => import('@/views/analyze/serverSearch/index'),
      //   meta: { title: '搜索数据库', icon: 'el-icon-data-analysis' },
      // },
    ]
  },
//   {
//     path: '/proofOnly',
//     component: Layout,
//     meta: {
//       title: '单检材分析',
//       icon: 'el-icon-pie-chart',
//     },
//     children: [
//       {
//           path: '/proofOnly/proof/index',
//           name: 'proof',
//           component: () => import('@/views/proofOnly/proof/index'),
//           meta: { title: '人脉圈子分析', icon: 'el-icon-pie-chart' },
//       },
//       {
//         path: '/proofOnly/fund/index',
//         name: 'proof',
//         component: () => import('@/views/proofOnly/fund/index'),
//         meta: { title: '资金消费分析', icon: 'el-icon-coin' },
//     },
//     {
//         path: '/appCircle/index',
//         name: 'proof',
//         component: () => import('@/views/appCircle/index'),
//         meta: { title: 'APP圈子', icon: 'el-icon-s-help' },
//     },
//     {
//         path: '/mapAnalyze/index',
//         name: 'proof',
//         component: () => import('@/views/mapAnalyze/index'),
//         meta: { title: '位置分析', icon: 'el-icon-map-location' },
//     },
//     ]
// },
  // {
  //   path: '/analyze/eventAnalysis',
  //   component: Layout,
  //   redirect: '/analyze/eventAnalysis',
  //   children: [{
  //     path: '/analyze/eventAnalysis',
  //     name: 'eventAnalysis',
  //     component: () => import('@/views/analyze/eventAnalysis/index'),
  //     meta: { title: '事件分析', icon: 'el-icon-s-opportunity' },
  //   }]
  // },
  // {
  //   path: '/analyze/moneyAnalysis',
  //   component: Layout,
  //   redirect: '/analyze/moneyAnalysis',
  //   children: [{
  //     path: '/analyze/moneyAnalysis',
  //     name: 'moneyAnalysis',
  //     component: () => import('@/views/analyze/moneyAnalysis/index'),
  //     meta: { title: '交易分析', icon: 'el-icon-coin' },
  //   }]
  // },
  // {
  //   path: '/analyze/positionAnalysis',
  //   component: Layout,
  //   redirect: '/analyze/positionAnalysis',
  //   children: [{
  //     path: '/analyze/positionAnalysis',
  //     name: 'positionAnalysis',
  //     component: () => import('@/views/analyze/positionAnalysis/index'),
  //     meta: { title: '位置分析', icon: 'el-icon-location-information' },
  //   }]
  // },

  {
    path: '/dashboard',
    component: Layout,
    children: [
      {
        path: '/dashboard',
        name: 'Dashboard',
        component: () => import('@/views/dashboard/index'),
        meta: { title:  $t("router.window"), icon: 'form',keepAlive: true}
      }
    ]
  },

  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  mode: 'hash', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
